﻿using System;
using System.Collections.Generic;
using System.Text;
using Ecreate.Model;
using Ecreate.Data;
namespace Ecreate.Business
{
    public class InfoService
    {
        public string getMessage()
        {
           IList<t_info> l= FactoryDBEngine.SqlMapper().QueryForList<t_info>("t_info_SelectAll", null);
           if (l.Count > 0)
           {
               return l[0].Message;
           }
           else
           {
               return "";

           }
        }
        public string getIntroduce()
        {
            IList<t_info> l= FactoryDBEngine.SqlMapper().QueryForList<t_info>("t_info_SelectAll", null);
            if (l.Count > 0)
            {
                return l[0].Introduce;
            }
            else
            {
                return "";
            }
        }

        public t_info getInfo()
        {
            IList<t_info> l = FactoryDBEngine.SqlMapper().QueryForList<t_info>("t_info_SelectAll", null);
            if (l.Count > 0)
            {
                return l[0];
            }
            else
            {
                return new t_info();
            }
        }
        public WebResult<t_info> InsertOrUpdate(t_info info)
        {
            info.Infoid = 0;
            WebResult<t_info> result = new WebResult<t_info>();
            FactoryDBEngine.SqlMapper().Insert("t_info_InsertUpdate", info);
            result.Message = "修改成功!";
            result.ResultObject = info;
            result.Success = true;
            return result;
        }


    }
}
